package com.ricky.web.table;

import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.stmt.QueryBuilder;
import com.j256.ormlite.stmt.Where;
import com.ricky.base.bean.DbClient;
import com.ricky.base.bean.SshClient;
import com.ricky.base.util.Sm4Util;

import java.util.List;
import java.util.UUID;

/**
 * @author Ricky
 * @date 2020/11/30
 */
public class Test {
    public static void main(String[] args) throws Exception {
        //        Server server = new Server();
        //        server.setHost("192.168.7.126");
        //        server.setName("uos测试服务器");
        //        server.setUsername(Sm4Util.encrypt("root", "username"));
        //        server.setPassword(Sm4Util.encrypt("root", "password"));
        //        server.setId(UUID.randomUUID().toString());
        //
        //        Service service = new Service();
        //        service.setId(UUID.randomUUID().toString());
        //        service.setServer(server);
        //        service.setName("测试服务");
        //
        //        DbClient dbClient = new DbClient("database.db");
        //        dbClient.insert(server);
        //        dbClient.insert(service);
        //
        //        List<Service> allService = dbClient.getAll(Service.class);
        //
        //        System.out.println(allService);
        //
        //        List<Server> allServer = dbClient.getAll(Server.class);
        //
        //        System.out.println(allServer);
        //
        //        dbClient.close();

        try (SshClient sshClient = new SshClient("192.168.7.126", "root", "root")) {
            //        sshClient.exec("ls /home/swx/test/");
            //        File upFile = new File("E:\\Users\\Ricky\\Desktop\\新建文本文档.txt");
            //        sshClient.uploadDile("/home/swx/test/", upFile);
            //        sshClient.downloadFile("/home/swx/test/", "新建文本文档.txt", "E:\\Users\\Ricky\\Desktop\\Case");
        }
    }
}
